package cn.itsource.service.impl;

import cn.itsource.bean.PetType;
import cn.itsource.mapper.PetTypeMapper;
import cn.itsource.service.IPetTypeService;
import cn.itsource.tree.TreeUtil;
import cn.itsource.util.JsonResult;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : 张金铭
 * @description :
 * @create :2022-11-20 15:18:00
 */
@Service
public class PetTypeServiceImpl extends ServiceImpl<PetTypeMapper, PetType> implements IPetTypeService {
    @Override
    public JsonResult getTree() {

        List<PetType> list = this.list();
        List<PetType> tree = TreeUtil.getTree(list);

        return JsonResult.success(tree);
    }
}
